
#include "lib.h"

#include "client.h"
#include "changespeed.h"


ChangeSpeed::ChangeSpeed(Client* client)
:Protocol(client)
{
}

ChangeSpeed::~ChangeSpeed()
{
}

bool8
ChangeSpeed::recognize(uint8* Msg, uint32 Len)
{
	return (Msg[0] == 'S' && Len == 3);
}

int32
ChangeSpeed::start(uint8* Msg, uint32 Len)
{
	int32 bytespersecond = client->msgGet(&Msg[1], (uint16*) 0);

	DEBUGMSG(("change download speed: %d bps", bytespersecond));

	client->setBytesPerSecond(bytespersecond);

	return EM_NoError;
}

void
ChangeSpeed::netIn(int32 Amt)
{
	client->protocolDone();
}

void
ChangeSpeed::netOut(int32 Amt)
{
	client->protocolDone();
}
